package cn.edu.scnu.service.impl;

import cn.edu.scnu.entity.Movie;
import cn.edu.scnu.mapper.SearchMapper;
import cn.edu.scnu.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SearchServiceImpl implements SearchService {

    @Autowired
    private SearchMapper searchMapper;

    @Override
    public List<Movie> searchMovies(String query, int page, int size) {
        int offset = page * size;
        return searchMapper.searchMovies(query, offset, size);
    }

    @Override
    public int countSearchMovies(String query) {
        return searchMapper.countSearchMovies(query);
    }
}
